From c841a8c868f35d36bb882db1a45a0a18dd111b30 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 3 Jul 2007 04:03:37 +0000 Subject: [PATCH] Allow stdin on posix gbser filename. --- gbser_posix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gbser_posix.c b/gbser_posix.c index 15bf4d007..689386ffe 100644 --- a/gbser_posix.c +++ b/gbser_posix.c @@ -117,10 +117,14 @@ void *gbser_init(const char *port_name) { h->magic = MYMAGIC; h->vmin = h->vtime = 0; - if (h->fd = open(port_name, O_RDWR | O_NOCTTY), h->fd == -1) { + if (0 == strcmp(port_name, "-") { + h->fd = 0; + return h; + } + else if (h->fd = open(port_name, O_RDWR | O_NOCTTY), h->fd == -1) { gbser__db(1, "Failed to open port (%s)\n", strerror(errno)); - goto failed; - } + goto failed; + } if (!isatty(h->fd)) { gbser__db(1, "%s is not a TTY\n"); -- 2.30.2